package cc.server.extension.utils;

import cn.dev33.satoken.interceptor.SaInterceptor;
import cn.dev33.satoken.jwt.StpLogicJwtForSimple;
import cn.dev33.satoken.stp.StpLogic;
import cn.dev33.satoken.stp.StpUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class SaTokenConfigure  implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        MyInterceptor myInterceptor = new MyInterceptor();
        registry.addInterceptor(myInterceptor)
                .addPathPatterns("/**"); // 这里设置你想要拦截的路径
        // 可以添加更多的配置，如order、excludePathPatterns等
    }
    // Sa-Token 整合 jwt (Simple 简单模式)
//    @Bean
//    public StpLogic getStpLogicJwt() {
//        return new StpLogicJwtForSimple();
//    }
//
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        System.out.println("注册拦截器 MyInterceptor");
//        registry.addInterceptor(new MyInterceptor()).addPathPatterns("/**");
//    }
}

